{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}DWDM{% endblock %}

{% block content %}

    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
       DWDM管理
      </h1>
      <ol class="breadcrumb">
        <li><a href={% url 'dashboard' %}><i class="fa fa-dashboard"></i> 主页</a></li>
        <li class="active">DWDM管理</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <form action={% url 'dwdm' %}  method="get">
            <div class="form-group">
              <div class="row">
                <div class="col-xs-4">
                  <label for="search">DWDM名称</label>
                  <textarea id='name' rows='1' class="form-control" name='name'></textarea>
                </div>
                <div class="col-xs-2">
                  <label for="search">厂商</label>
                  <input type="text" class="form-control" name='manufacturer'>
                </div>
                <div class="col-xs-2">
                  <label for="search">型号</label>
                  <input type="text" class="form-control" name='modelnumber'>
                </div>
                <div class="col-xs-2">
                  <label for="search">状态</label>
                  <select class="form-control" name='status' id='status'>
                    <option selected value></option>
                    <option value='0'>运营</option>
                    <option value='1'>拆除</option>
                    <option value='2'>待启用</option>
                  </select>
                </div>
                <div class="col-xs-2">
                  <label for="search">业务线</label>
                  <select class="form-control" name='business_unit' id='business_unit'>
                    <option selected value></option>
                    <option value='0'>领骏</option>
                    <option value='1'>驰联</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="row">  
                <div class="col-xs-3">
                  <label for="search">起始端机房</label>
                  <input type="text" class="form-control" name='machineroom_a'>
                </div>
                <div class="col-xs-3">
                  <label for="search">终止端机房</label>
                  <input type="text" class="form-control" name='machineroom_z'>
                </div>
                <div class="col-xs-2">
                  <label for="search">维护人</label>
                  <input type="text" class="form-control" name='maintainer'>
                </div>
                <div class="col-xs-2">
                  <label for="search">是否OEO</label>
                  <select class="form-control" name='oeo' id='oeo'>
                    <option selected value></option>
                    <option value='0'>是</option>
                    <option value='1'>否</option>
                  </select>
                </div>
                <div class="col-xs-2">
                  <label for="search">是否OLP</label>
                  <select class="form-control" name='olp' id='olp'>
                    <option selected value></option>
                    <option value='0'>是</option>
                    <option value='1'>否</option>
                  </select>
                </div>
              </div>
            </div>
            <p style=" margin:0 auto; text-align:center;">
              <button type="submit" id="searchbutton" align="center" class="btn">查询</button>
            </p>
           </form>
    <div class="row">
    <div class="col-xs-12">
      <div>
          <label class="checkbox-inline">
          DWDM名称<input type="checkbox" class="toggle-vis" data-column="0" name="checkbox" checked="checked"/>
          </label>
          <label class="checkbox-inline">
          型号<input type="checkbox" class="toggle-vis" data-column="1" name="checkbox" checked="checked"/>
          </label>
          <label class="checkbox-inline">
          厂商<input type="checkbox" class="toggle-vis" data-column="2" name="checkbox" checked="checked"/>
          </label>
           <label class="checkbox-inline">
           设备高度(U)<input type="checkbox" class="toggle-vis" name="checkbox" data-column="3"/>
           </label>
           <label class="checkbox-inline">
           状态<input type="checkbox" class="toggle-vis" data-column="4" name="checkbox" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           业务线<input type="checkbox" class="toggle-vis" data-column="5" name="checkbox" checked="checked"/>
           </label>
           <label class="checkbox-inline">
           合波器型号<input type="checkbox" class="toggle-vis" name="checkbox" data-column="6"/>
           </label>
           <label class="checkbox-inline">
           BA放大器<input type="checkbox" class="toggle-vis" name="checkbox" data-column="7"/>
           </label>
           <label class="checkbox-inline">
           PA放大器<input type="checkbox" class="toggle-vis" name="checkbox" data-column="8"/>
           </label>
           <label class="checkbox-inline">
           色散补偿<input type="checkbox" class="toggle-vis" name="checkbox" data-column="9" />
           </label>
           <label class="checkbox-inline">
           OEO<input type="checkbox" class="toggle-vis" name="checkbox" data-column="10"/>
           </label>
           <label class="checkbox-inline">
           OLP<input type="checkbox" class="toggle-vis" name="checkbox" data-column="11"/>
           </label>
           <label class="checkbox-inline">
           维护人<input type="checkbox" class="toggle-vis" name="checkbox" data-column="12"/>
           </label>
           <label class="checkbox-inline">
           起始端机房<input type="checkbox" class="toggle-vis" name="checkbox" data-column="13"/>
           </label>
           <label class="checkbox-inline">
           起始端机架<input type="checkbox" class="toggle-vis" name="checkbox" data-column="14"/>
           </label>
           <label class="checkbox-inline">
           起始端设备固资<input type="checkbox" class="toggle-vis" name="checkbox" data-column="15"/>
           </label>
           <label class="checkbox-inline">
           终止端机房<input type="checkbox" class="toggle-vis" name="checkbox" data-column="16"/>
           </label>
           <label class="checkbox-inline">
           终止端机架<input type="checkbox" class="toggle-vis" name="checkbox" data-column="17"/>
           </label>
           <label class="checkbox-inline">
           终止端设备固资<input type="checkbox" class="toggle-vis" name="checkbox" data-column="18"/>
           </label>
           <label class="checkbox-inline">
           备注<input type="checkbox" class="toggle-vis" name="checkbox" data-column="19"/>
           </label>
      </div>
      <div class="box">
        <div class="box-header">
          <h4 class="box-title">查询结果</h4>
          <a href= {% url 'assetimport' 'DWDM' %}><button type="submit" class="btn btn-default pull-right">DWDM导入</button></a>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
          <table id="dwdm_table" class="display table table-bordered table-striped">
            <thead>
            <tr>
              <th>DWDM名称</th>
              <th>型号</th>
              <th>厂商</th>
              <th>设备高度(U)</th>
              <th>状态</th>
              <th>业务线</th>
              <th>合波器</th>
              <th>BA放大器</th>
              <th>PA放大器</th>
              <th>色散补偿</th>
              <th>OEO</th>
              <th>OLP</th>
              <th>维护人</th>
              <th>起始端机房</th>
              <th>起始端机架</th>
              <th>起始端设备固资</th>
              <th>终止端机房</th>
              <th>终止端机架</th>
              <th>终止端设备固资</th>
              <th>备注</th>
            </tr>
            </thead>
            <tbody>
                {% for dwdm in dwdm %}
                <tr>
                  <td><a href="{% url 'dwdmdetail' dwdm.id %}" target=_blank >{{ dwdm.name }}</td>
                  <td>{{ dwdm.modelnumber|default:'' }}</td>
                  <td>{{ dwdm.manufacturer|default:'' }}</td>
                  <td>{{ dwdm.high|default:'' }}</td>  
                  <td>{{ dwdm.get_status_display }}</td>
                  <td>{{ dwdm.get_business_unit_display}}</td>
                  <td>{{ dwdm.mux|default:'' }}</td>                
                  <td>{{ dwdm.ba|default:'' }}</td>
                  <td>{{ dwdm.pa|default:'' }}</td>
                  <td>{{ dwdm.dcm|default:'' }}</td>
                  <td>{{ dwdm.get_oeo_display }}</td>
                  <td>{{ dwdm.get_olp_display }}</td>
                  <td>{{ dwdm.maintainer|default:'' }}</td>
                  <td>{{ dwdm.machineroom_a|default:'' }}</td>
                  <td>{{ dwdm.cabinet_a|default:'' }}</td>
                  <td>{{ dwdm.device_a_number|default:'' }}</td>
                  <td>{{ dwdm.machineroom_z|default:'' }}</td>
                  <td>{{ dwdm.cabinet_z|default:'' }}</td>
                  <td>{{ dwdm.device_a_number|default:'' }}</td>
                  <td>{{ dwdm.memo|default:'' }}</td>
                </tr>
                {% empty %}
                  <tr>没有数据！</tr>
                {% endfor %}

            </tbody>
          </table>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
    </div>
    <!-- /.row -->
    </section>

{% endblock %}
{% block page-script %}
<script src="{% static 'js/mygeturl.js' %}"></script>
<script>
$("#checkall").click(function () {
        if (this.checked) {
            $("input[name='checkbox']").each(function () {
                this.checked = true;
            });
        } else {
            $("input[name='checkbox']").each(function () {
                this.checked = false;
            });
        }
    }
);
</script>
{% endblock %}
